package com.wen.edu.controller.front;

import com.wen.commonutils.ResultEntity;
import com.wen.edu.entity.EduCourse;
import com.wen.edu.entity.EduTeacher;
import com.wen.edu.service.EduCourseService;
import com.wen.edu.service.EduTeacherService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：Win
 * @Date: 2021/6/13 15:57
 * @Description:
 */
@RestController
@RequestMapping("/edu/service/front")
public class FrontIndexController {
    @Resource
    private EduCourseService eduCourseService;
    @Resource
    private EduTeacherService eduTeacherService;

    //    查询前台首页面显示的8条热门课程和4条名师信息(均可按照id降序排列)
    @GetMapping("index")
    public ResultEntity index() {
        List<EduCourse> eduCourses = eduCourseService.selectHotCourses();
        List<EduTeacher> eduTeachers = eduTeacherService.selectFamousTeacher();
        return ResultEntity.ok().data("courseList", eduCourses).data("teacherList", eduTeachers);
    }
}
